import { Sequelize } from 'sequelize';

// 初始化 Sequelize 实例

export const sequelize = new Sequelize('db', 'root', '123456', {
    host: 'localhost',
    dialect: 'mysql'  // 可选: 'mysql', 'sqlite', 'postgres', 'mssql'
    // storage: './userdb'
  });

  // 测试数据库连接
  // async function testConnection() {
  //   try { 
  //     await sequelize.authenticate();
  //     console.log('Connection has been established successfully.');
  //   } catch (error) {
  //     console.error('Unable to connect to the database:', error);
  //   }
  // }

  // testConnection();

